b36856b7bdb055d89052396daf468f97a5789de0,src/main/java/com/github/zhanhb/ckfinder/connector/handlers/command/DeleteFolderCommand.java,DeleteFolderCommand,getDataForXml,#,39
Before Change
@Override
protected int getDataForXml() {
if (!checkIfTypeExists(this.type)) {
this.type = null;
return Constants.Errors.CKFINDER_CONNECTOR_ERROR_INVALID_TYPE;
}
if (!configuration.getAccessControl().checkFolderACL(this.type,
this.currentFolder,
this.userRole,
AccessControl.CKFINDER_CONNECTOR_ACL_FOLDER_DELETE)) {
return Constants.Errors.CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED;
}
if (this.currentFolder.equals("/")) {
After Change
*/
@Override
protected int getDataForXml() {
if (!checkIfTypeExists(getType())) {
this.setType(null);
return Constants.Errors.CKFINDER_CONNECTOR_ERROR_INVALID_TYPE;
}
if (!getConfiguration().getAccessControl().checkFolderACL(getType(),
getCurrentFolder(),
getUserRole(),
AccessControl.CKFINDER_CONNECTOR_ACL_FOLDER_DELETE)) {
return Constants.Errors.CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED;
}
if (this.getCurrentFolder().equals("/")) {
return Constants.Errors.CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST;
}
if (FileUtils.checkIfDirIsHidden(this.getCurrentFolder(), getConfiguration())) {
return Constants.Errors.CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST;
}
Path dir = Paths.get(getConfiguration().getTypes().get(this.getType()).getPath()
+ this.getCurrentFolder());
try {
if (!Files.exists(dir) || !Files.isDirectory(dir)) {
return Constants.Errors.CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND;
}
if (FileUtils.delete(dir)) {
Path thumbDir = Paths.get(getConfiguration().getThumbsPath(),
this.getType()
+ this.getCurrentFolder());
FileUtils.delete(thumbDir);
} else {
return Constants.Errors.CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED;